﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo.aspx.cs" Inherits="demo" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
    
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
        
         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
    
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" 
         AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
          AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"
           ondatabound="RadGrid1_DataBound" onitemdeleted="RadGrid1_ItemDeleted" 
        oniteminserted="RadGrid1_ItemInserted" 
        onitemupdated="RadGrid1_ItemUpdated" Skin="Office2007" 
        onitemcommand="RadGrid1_ItemCommand" PageSize="5" >
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

<MasterTableView AutoGenerateColumns="False" DataKeyNames="machuyenmuc" 
                DataSourceID="SqlDataSource1"  CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>

    <Columns>
        <telerik:GridBoundColumn DataField="machuyenmuc" DataType="System.Int32" 
            FilterControlAltText="Filter machuyenmuc column" HeaderText="machuyenmuc" 
            ReadOnly="True" SortExpression="machuyenmuc" UniqueName="machuyenmuc">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="tenchuyenmuc" 
            FilterControlAltText="Filter tenchuyenmuc column" HeaderText="tenchuyenmuc" 
            SortExpression="tenchuyenmuc" UniqueName="tenchuyenmuc">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="mota" 
            FilterControlAltText="Filter mota column" HeaderText="mota" 
            SortExpression="mota" UniqueName="mota">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="matinhtrangcm" DataType="System.Int32" 
            FilterControlAltText="Filter matinhtrangcm column" HeaderText="matinhtrangcm" 
            SortExpression="matinhtrangcm" UniqueName="matinhtrangcm">
        </telerik:GridBoundColumn>
         <telerik:GridButtonColumn ConfirmText="Delete this thành viên?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridButtonColumn>
    </Columns>

<EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="mathanhvien" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Thanhvien">
<EditColumn FilterControlAltText="Filter EditCommandColumn column" ></EditColumn>
<FormTemplate>
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                        style="border-collapse: collapse; background: white;">
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small">
                                <b>Thêm thành viên</b>
                            </td>
                        </tr>           
 <table style="width: 61%">
        <tr>
            <td style="width: 562px">
                Tên thành viên</td>
            <td style="width: 250px">
                <asp:TextBox ID="txttenthanhvien" runat="server" Text='<%# Bind("tenthanhvien") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="nhập tên" ControlToValidate="txttenthanhvien"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 562px">
                Chức vụ</td>
            <td style="width: 250px">
                <asp:TextBox ID="txtchucvu" runat="server" Text='<%# Bind("chucvu") %>'></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="nhập chức vụ" ControlToValidate="txtchucvu"></asp:RequiredFieldValidator>
            </td>
        </tr>
         <tr>
            <td style="width: 562px">
                Email</td>
            <td style="width: 250px">
                <asp:TextBox ID="txtemail" runat="server" Text='<%# Bind("email") %>'></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="nhập email" ControlToValidate="txtemail"></asp:RequiredFieldValidator>
                 
            </td>
        </tr>
         <tr>
            <td style="width: 562px">
                Hình</td>
            <td style="width: 250px">
                <asp:TextBox ID="txthinh" runat="server" Text='<%# Bind("hinh") %>'></asp:TextBox>
            </td>
        </tr>
        <tr>
         <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                  
                                 
                            </td>
        </tr>
        </table>
        </table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
 <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
            SelectCommand="SELECT * FROM [CHUYENMUC]"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
